package me.tuyou.orm.dao;

import me.tuyou.orm.po.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description
 * @Author tuyou_cd
 * @Date 2020/6/4 15:50
 */
public interface UserDao {

    @Insert("insert into user(name, age) values(#{name}, #{age})")
    int save(User user);

    @Update("update user set name = #{name}, age = #{age} where id = #{id}")
    int update(User user);

    @Delete("delete from user where id = #{id}")
    int delete(int id);

    @Select("select * from user where id = #{id}")
    User getById(int id);

    @Select("select * from user")
    List<User> selectAll();
}
